﻿@model IEnumerable<FCNS.ERP.Models.ErpPurchaseOrder>

@{
    ViewBag.Title = ViewData["Flag"];
    Layout = "~/Views/Jxc/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>

<p>
    @{
        var f = (int)ViewData["Flag"];
     }
    <a class="newObjA" href="/Jxc/PurchaseOrderNew?flag=@f">新增</a>
</p>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.CorSId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.OrderNO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DateTimeStart)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.StoreId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Money)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Advance)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.InvoiceType)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.CorS.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.OrderNO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DateTimeStart)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Store.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Money)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Advance)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.InvoiceType)
        </td>

        <td>
            @switch (item.PurchaseStatus)
    {
        case FCNS.ERP.Models.ErpPurchaseOrder.EnumPurchaseStatus.下单:
            @Html.ActionLink("编辑", "PurchaseOrderEdit", new { id = item.Id }) @Html.Raw(" | ")
            @Html.ActionLink("审核", "PurchaseOrderShenHe", new { id = item.Id }) @Html.Raw(" | ")
            <a href="PurchaseOrderDelete/@item.Id" class="objDelete">删除</a>
    break;

case FCNS.ERP.Models.ErpPurchaseOrder.EnumPurchaseStatus.审核:
case FCNS.ERP.Models.ErpPurchaseOrder.EnumPurchaseStatus.待支付预付款:
        @Html.ActionLink("打印", "ReportPrint", new { flag = 0, id = item.Id, str = "" }, htmlAttributes: new { @target = "_blank" }) @Html.Raw(" | ")
        <a href="PurchaseOrderDelete/@item.Id" class="objDelete">删除</a>

break;
}

        </td>


    </tr>
    }

</table>
